function isEMail(s)
	{
		if(((s.indexOf("@"))==-1) || ((s.indexOf("."))==-1))
		{
			return true ;  
		}else{
			var x=s;
			var ctr=0;
			var dot=0;
			for(j=0;j<x.length;j++)
			{
				if(x.charAt(j)=="@"){
					ctr++;
				}
				if(x.charAt(j)=="."){
					dot++;
				}
			}
			if(ctr==0 || dot==0){
				return true;
			}else{
				return false;
			}
		}
	}

function validEmailAddress(email)
{
		invalidChars = " /:,;~"
		if (email == "") 
		{
			return (false);
		}
		for (i=0; i<invalidChars.length; i++) 
		{
			badChar = invalidChars.charAt(i)
			if (email.indexOf(badChar,0) != -1) 
			{
				return (false);
			}
		}
		atPos = email.indexOf("@",1)
		if (atPos == -1) 
		{
			return (false);
		}
		if (email.indexOf("@",atPos+1) != -1) 
		{
			return (false);
		}
		periodPos = email.indexOf(".",atPos)
		if (periodPos == -1) 
		{
			return (false);
		}
		if (periodPos+3 > email.length)	
		{
			return (false);
		}
			
		return (true);
}


	function isValidEmail(s)
	{
		var myRe;
		var myArr;
		myRe = new RegExp("\[^a-zA-Z0-9_@.,]");
		myArr=myRe.test(s);
		if(myArr){ 
			return myArr
		}else{
			if(s.length<=3){
				return true;
			}
			ch=isEMail(s)
			if(ch){
				return true;
			}else{
				return false;
			}
		}
	}

function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}